/** fMSX: portable MSX emulator ******************************/ /** **/ /** MSX.h **/ /** **/ /** This file contains declarations relevant to the drivers **/ /** and MSX emulation itself. See Z80.h for #defines **/ /** related to Z80 emulation. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994,1995 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ #include "Z80.h" /* Z80 emulation declarations */ #define PAGESIZE 0x4000L /* Size of a RAM page */ #define NORAM 0xFF /* Byte to be returned from */ /* non-existing pages and ports */ #define MAXSCREEN 8 /* Highest screen mode supported */ /***** Following are macros to be used in screen drivers *****/ #define BigSprites (VDP[1]&0x01) /* Zoomed sprites */ #define Sprites16x16 (VDP[1]&0x02) /* 16x16/8x8 sprites */ #define SpritesOFF (VDP[8]&0x02) /* Don't show sprites */ #define ScreenON (VDP[1]&0x40) /* Show screen */ #define SolidColor0 (VDP[8]&0x20) /* Solid/Tran. COLOR 0 */ #define ScanLines212 (VDP[9]&0x80) /* 212/192 scanlines */ /*************************************************************/ /******** Variables used to control emulator behavior ********/ extern byte Verbose; /* Debug msgs ON/OFF */ extern byte MSXVersion; /* 0=MSX,1=MSX2,2=MSX2+*/ extern byte ROMTypeA,ROMTypeB; /* MegaROM types */ extern int RAMPages,VRAMPages; /* Number of RAM pages */ /*************************************************************/ extern byte *VRAM; /* Video RAM */ extern byte JoyState[2]; /* Joystick states */ extern byte KeyMap[16]; /* Keyboard map */ extern char *CartA; /* Cartridge A ROM file*/ extern char *CartB; /* Cartridge B ROM file*/ extern char *FontName; /* Font file for text */ extern byte *FontBuf; /* Font for text modes */ extern byte UseFont; /* Use ext.font when 1 */ extern byte UPeriod; /* Number of interrupts/screen update */ extern byte *ChrGen,*ChrTab,*ColTab; /* VDP tables [screens]*/ extern byte *SprGen,*SprTab,*SprCol; /* VDP tables [sprites]*/ extern byte Palette[32][3]; /* Palette registers */ extern byte FGColor,BGColor; /* Colors */ extern byte XFGColor,XBGColor; /* Second set of colors*/ extern byte ScrMode; /* Current screen mode */ extern byte ScanLine; /* Current scanline */ extern byte EndOfFrame; /* 1 when end of frame */ extern byte VDP[64],VDPStatus[16]; /* VDP registers */ extern byte PSG[16],SCC[256]; /* PSG,SCC,OPLL reg-s */ extern byte OPLL[256]; /****************************************************************/ /*** These functions are called to initialize and refresh ***/ /*** various SCREENs. ***/ /************************************** TO BE WRITTEN BY USER ***/ int InitTx80(void);void ColorsTx80(void); int InitScr0(void);void ColorsScr0(void); int InitScr1(void);void ColorsScr1(void); int InitScr2(void);void ColorsScr2(void); int InitScr3(void);void ColorsScr3(void); int InitScr4(void);void ColorsScr4(void); int InitScr5(void);void ColorsScr5(void); int InitScr6(void);void ColorsScr6(void); int InitScr7(void);void ColorsScr7(void); int InitScr8(void);void ColorsScr8(void); int InitScrF(void);void ColorsScrF(void); void RefreshTx80(byte Y1,byte Y2); void RefreshScr0(byte Y1,byte Y2); void RefreshScr1(byte Y1,byte Y2); void RefreshScr2(byte Y1,byte Y2); void RefreshScr3(byte Y1,byte Y2); void RefreshScr4(byte Y1,byte Y2); void RefreshScr5(byte Y1,byte Y2); void RefreshScr6(byte Y1,byte Y2); void RefreshScr7(byte Y1,byte Y2); void RefreshScr8(byte Y1,byte Y2); /****************************************************************/ /*** This function is called to poll keyboard. ***/ /************************************** TO BE WRITTEN BY USER ***/ void Keyboard(void); /****************************************************************/ /*** This function is called on each write to PPI to generate ***/ /*** sound via the 7th bit of PPI register. ***/ /************************************** TO BE WRITTEN BY USER ***/ void PPIOut(byte Toggle); /****************************************************************/ /*** This function is called on each write to PSG to generate ***/ /*** sound based on written values. ***/ /************************************** TO BE WRITTEN BY USER ***/ void PSGOut(byte R,byte V); /****************************************************************/ /*** This function is called on each write to OPLL to ***/ /*** to generate sound based on written values. ***/ /************************************** TO BE WRITTEN BY USER ***/ void OPLLOut(byte R,byte V); /****************************************************************/ /*** This function is called on each write to SCC to generate ***/ /*** sound based on written values. ***/ /************************************** TO BE WRITTEN BY USER ***/ void SCCOut(byte R,byte V); /****************************************************************/ /*** Allocate memory, load ROM images, initialize mapper, VDP ***/ /*** CPU and start the emulation. This function returns 0 in ***/ /*** the case of failure. ***/ /****************************************************************/ int StartMSX(void); /****************************************************************/ /*** Free memory allocated by StartMSX(). ***/ /****************************************************************/ void TrashMSX(void); /****************************************************************/ /*** Allocate resources needed by the machine-dependent code. ***/ /************************************** TO BE WRITTEN BY USER ***/ int InitMachine(void); /****************************************************************/ /*** Deallocate all resources taken by InitMachine(). ***/ /************************************** TO BE WRITTEN BY USER ***/ void TrashMachine(void);